// import 'dart:nativewrappers/_internal/vm/lib/core_patch.dart';

class HomeCommonData {
  HomeCommonData.fromJson(dynamic json) {
    code = json['code'];
    msg = json['msg'];
    data = HomeStatusInfo.fromJson(json['data']);
  }

  int? code;
  String? msg;
  HomeStatusInfo? data;
}

class HomeStatusInfo {
  HomeStatusInfo.fromJson(dynamic json) {
    lampCount = json['lamp_count'];
    lampOnPencent = json['lamp_on_pencent'];
    lampFaultPencent = json['lamp_fault_pencent'];
    if (json['lamp_trend_chart'] != null) {
      lampTrendChart = HomeStatusChartInfo.fromJson(json['lamp_trend_chart']);
    } else {
      json['lamp_trend_chart'] = HomeStatusChartInfo.fromJson(
          {'onArr': [], 'faultArr': [], 'timeArr': []});
    }
  }

  int? lampCount;
  int? lampOnPencent;
  int? lampFaultPencent;
  HomeStatusChartInfo? lampTrendChart;
}

class HomeStatusChartInfo {
  HomeStatusChartInfo.fromJson(dynamic json) {
    if (json['onArr'] != null) {
      onArr = [];
      json['onArr'].forEach((v) {
        onArr?.add(v);
      });
    } else {
      json['onArr'] = [];
    }
    if (json['faultArr'] != null) {
      faultArr = [];
      json['faultArr'].forEach((v) {
        faultArr?.add(v);
      });
    } else {
      json['faultArr'] = [];
    }
    if (json['timeArr'] != null) {
      timeArr = [];
      json['timeArr'].forEach((v) {
        timeArr?.add(v);
      });
    } else {
      json['timeArr'] = [];
    }
  }

  List<int>? onArr;
  List<int>? faultArr;
  List<String>? timeArr;
}

class HomeLampList {
  HomeLampList.fromJson(dynamic json) {
    total = json['total'];
    lastPage = json['last_page'];
    if (json['data'] != null) {
      data = [];
      json['data'].forEach((v) {
        data?.add(HomeLampData.fromJson(v));
      });
    } else {
      json['data'] = [];
    }
  }

  int? total;
  int? lastPage;
  List<HomeLampData>? data;
}

class HomeLampData {
  HomeLampData.fromJson(dynamic json) {
    id = json['id'];
    factory = json['factory'];
    imei = json['imei'];
    statusName = json['status_name'];
    lastUpTime = json['last_up_time'];
    if (json['data'] != null) {
      data = HomeLampStatusData.fromJson(json['data']);
    } else {
      json['data'] = HomeLampStatusData.fromJson({'coordinates': ''});
    }

    if (json['unit'] != null) {
      unit = HomeLampUnitData.fromJson(json['unit']);
    } else {
      json['data'] = HomeLampUnitData.fromJson({'name': ''});
    }

    if (json['lamp_type'] != null) {
      lampType = HomeLampTypeData.fromJson(json['lamp_type']);
    } else {
      json['lamp_type'] = HomeLampTypeData.fromJson({'name': ''});
    }
    // data = HomeLampStatusData.fromJson(json['data']);

    // lampTrendChart = json['lamp_trend_chart'];
  }

  int? id;
  String? factory;
  String? imei;
  String? statusName;
  String? lastUpTime;
  HomeLampStatusData? data;
  HomeLampUnitData? unit;
  HomeLampTypeData? lampType;
// int? lampTrendChart;
}

class HomeLampStatusData {
  HomeLampStatusData.fromJson(dynamic json) {
    coordinates = json['coordinates'];

    // lampTrendChart = json['lamp_trend_chart'];
  }

  String? coordinates;
// int? lampTrendChart;
}

class HomeLampUnitData {
  HomeLampUnitData.fromJson(dynamic json) {
    name = json['name'];

    // lampTrendChart = json['lamp_trend_chart'];
  }

  String? name;
// int? lampTrendChart;
}

class HomeLampTypeData {
  HomeLampTypeData.fromJson(dynamic json) {
    name = json['name'];

    // lampTrendChart = json['lamp_trend_chart'];
  }

  String? name;
// int? lampTrendChart;
}

class HomeLoginErrData {
  HomeLoginErrData.fromJson(dynamic json) {
    code = json['code'];
    msg = json['msg'];
  }

  int? code;
  String? msg;
}

class HomeLoginData {
  HomeLoginData.fromJson(dynamic json) {
    code = json['code'];
    msg = json['msg'];
    data = HomeLoginInfo.fromJson(json['data']);
  }

  int? code;
  String? msg;
  HomeLoginInfo? data;
}

class HomeLoginInfo {
  HomeLoginInfo.fromJson(dynamic json) {
    accessToken = json['access_token'];
    tokenType = json['token_type'];
    expiresIn = json['expires_in'];
    // lampTrendChart = json['lamp_trend_chart'];
  }

  String? accessToken;
  String? tokenType;
  String? expiresIn;
// int? lampTrendChart;
}

class HomeLampInfo {
  HomeLampInfo.fromJson(dynamic json) {
    code = json['code'];
    msg = json['msg'];
    // data = HomeLoginInfo.fromJson(json['data']);
  }

  int? code;
  String? msg;
// HomeLoginInfo? data;
}
